
package main
import (
	"fmt"
	"time"
)

//程序运行完成时一定要有输出语句，本工具才能正确展示运行结果。
//fmt.Println("Hello JSRUN!   \n\n         - from Golang .")
func main() {

	_ch := make(chan int)
	defer close(_ch)
	
	go func ()  {
		start := time.Now() // 获取当前时间
		var c  int	= 0
		var t  time.Duration = 500 * time.Millisecond
		for {
			if c < 50 {
				fmt.Println(">>>>>>>>>>",t)
				time.Sleep(t) 
				c += 1
				t =  time.Millisecond * time.Duration(1000 * 2 * c)
			}else{
				break
			}
		}
		_ch <- 0
		elapsed := time.Since(start)
		fmt.Println("该函数执行完成耗时：", elapsed)
	}()

	for  {
		<- _ch
	}

	fmt.Println("\nHello JSRUN!   \n\n         - from Golang .")
}


